<template>
  <div class="container">
    <div class="tips-title">1.基础用法</div>
    <span class="tips-title-sub">hover(默认)激活:</span>
    <el-dropdown>
      <span class="el-dropdown-link">
        下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>黄金糕</el-dropdown-item>
        <el-dropdown-item>狮子头</el-dropdown-item>
        <el-dropdown-item>螺蛳粉</el-dropdown-item>
        <el-dropdown-item disabled>双皮奶</el-dropdown-item>
        <el-dropdown-item divided>蚵仔煎</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <span class="tips-title-sub">click激活:</span>
    <el-dropdown trigger="click">
      <span class="el-dropdown-link">
        下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>黄金糕</el-dropdown-item>
        <el-dropdown-item>狮子头</el-dropdown-item>
        <el-dropdown-item>螺蛳粉</el-dropdown-item>
        <el-dropdown-item disabled>双皮奶</el-dropdown-item>
        <el-dropdown-item divided>蚵仔煎</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <div class="tips-title">2.触发对象</div>
    <el-dropdown>
      <el-button type="primary">
        更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
      </el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item,index) in testData" :key="index">{{item}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-dropdown split-button type="primary">
      更多菜单
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item,index) in testData" :key="index">{{item}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <div class="tips-title">3.不同尺寸<span class="tips-explain">medium/small/mini</span></div>
    <el-dropdown size="medium" split-button type="primary">
      更多菜单
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item,index) in testData" :key="index">{{item}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-dropdown size="small" split-button type="primary">
      更多菜单
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item,index) in testData" :key="index">{{item}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-dropdown size="mini" split-button type="primary">
      更多菜单
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item,index) in testData" :key="index">{{item}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <div class="tips-title">4.指令事件</div>
    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link">
        下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="a">黄金糕</el-dropdown-item>
        <el-dropdown-item command="b">狮子头</el-dropdown-item>
        <el-dropdown-item command="c">螺蛳粉</el-dropdown-item>
        <el-dropdown-item command="d" disabled>双皮奶</el-dropdown-item>
        <el-dropdown-item command="e" divided>蚵仔煎</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
  const testData = [
    '黄金糕','狮子头','螺蛳粉','双皮奶','蚵仔煎'
  ];

  export default {
    name: 'na-dropdown',
    data() {
      return {
        testData: testData
      }
    },
    methods: {
      handleCommand(command) {
        this.$message('click on item ' + command);
      }
    }
  }
</script>
<style>
</style>
